//
//  IndustryController.m
//  XiangCaoJiaYuan
//
//  Created by tongj on 2017/8/21.
//  Copyright © 2017年 tongj. All rights reserved.
//

#import "IndustryController.h"
#import "UIButton+LT.h"
@interface IndustryController ()
@property(nonatomic,strong)NSArray* arrDataSource;
@property(nonatomic,strong)NSArray* arrImage;

@end

@implementation IndustryController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"选择行业";
    [UIButton backButton:self.navigationItem Col:self];
    _arrDataSource = @[@"生活服务",@"餐饮",@"服装",@"日用",@"其他"];
    _arrImage = @[@"服务-2@2x",@"餐饮-2@2x",@"服装-2@2x",@"日用-2@2x",@"其他-2@2x"];
    
//    self.view.backgroundColor = HEXRGB(<#rgbValue#>)
    UIImageView *backImageView=[[UIImageView alloc]initWithFrame:self.view.bounds];
    [backImageView setImage:[UIImage imageNamed:@"背景"]];
    self.tableView.backgroundView=backImageView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return _arrDataSource.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString* ID = @"CELL";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell==nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",_arrImage[indexPath.row]]];
    cell.backgroundColor=[UIColor clearColor];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    if (indexPath.row==0)
    {
        
        cell.textLabel.text = @"生活服务";
        cell.frame = CGRectMake(cell.imageView.frame.size.width, cell.frame.size.height/2, [UIScreen mainScreen].bounds.size.width-cell.imageView.frame.size.width, 21);
        cell.textLabel.textAlignment = NSTextAlignmentCenter;
        cell.textLabel.font = [UIFont systemFontOfSize:21];
        cell.textLabel.textColor = HEXRGB(0xd81e06);
    }
    else if (indexPath.row==1)
    {
        cell.textLabel.text = @"餐        饮";
        cell.frame = CGRectMake(cell.imageView.frame.size.width, cell.frame.size.height/2, [UIScreen mainScreen].bounds.size.width-cell.imageView.frame.size.width, 21);
        cell.textLabel.textAlignment = NSTextAlignmentCenter;
        cell.textLabel.font = [UIFont systemFontOfSize:21];
        cell.textLabel.textColor = HEXRGB(0x1296db);
    }else if (indexPath.row==2)
    {
        cell.textLabel.text = @"服       装";
        cell.frame = CGRectMake(cell.imageView.frame.size.width, cell.frame.size.height/2, [UIScreen mainScreen].bounds.size.width-cell.imageView.frame.size.width, 21);
        cell.textLabel.textAlignment = NSTextAlignmentCenter;
        cell.textLabel.font = [UIFont systemFontOfSize:21];
        cell.textLabel.textColor = HEXRGB(0xd4237a);
    }else if (indexPath.row==3){
        
        cell.textLabel.text = @"日        用";
        cell.frame = CGRectMake(cell.imageView.frame.size.width, cell.frame.size.height/2, [UIScreen mainScreen].bounds.size.width-cell.imageView.frame.size.width, 21);
        cell.textLabel.textAlignment = NSTextAlignmentCenter;
        cell.textLabel.font = [UIFont systemFontOfSize:21];
        cell.textLabel.textColor = HEXRGB(0x3cb83a);
    }
    else
    {
        cell.textLabel.text = @"其        他";
        cell.frame = CGRectMake(cell.imageView.frame.size.width, cell.frame.size.height/2, [UIScreen mainScreen].bounds.size.width-cell.imageView.frame.size.width, 21);
        cell.textLabel.textAlignment = NSTextAlignmentCenter;
        cell.textLabel.font = [UIFont systemFontOfSize:21];
        cell.textLabel.textColor = HEXRGB(0xf4ea2a);
    }
    return cell;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 70;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Table view delegate

// In a xib-based application, navigation from a table can be handled in -tableView:didSelectRowAtIndexPath:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here, for example:
    // Create the next view controller.
    <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:<#@"Nib name"#> bundle:nil];
    
    // Pass the selected object to the new view controller.
    
    // Push the view controller.
    [self.navigationController pushViewController:detailViewController animated:YES];
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
